<?php
include '../variables/varConector.php';


if ($_REQUEST["opc"] == '') {

       include '../funciones/funciones.php';
       echo "<div style=\"padding-left: 80px; padding-right: 80px; padding-top: 150px;\" align=\"center\">";
       cadenaFondoAzul("Insertar C&eacute;dula");
       echo "</div>";
?>
       <div style="padding-left: 100px; padding-right: 100px; padding-top: 5px;">
              <div style="width: 300px; background-color: aquamarine;" align="center">

              <form action="?p=chofer/buscarChofer&opc=busco" method="POST">
                     <table>
                            <tr>
                                   <td align="left" style="width: 100px;">C&eacute;dula</td>
                                   <td>
                                          <input name="cedula" id="cedula" type="text" style="width: 150px;">
                                   </td>
                            </tr>
                            <tr>
                                   <td colspan="2" align="center">
                                          <input type="submit" value="Buscar">
                                   </td>
                            </tr>
                     </table>
              </form>


       </div>
</div>

<?php
              } else
              if ($_REQUEST["opc"] == 'busco') {

                     include '../funciones/funciones.php';

                     foreach ($_REQUEST AS $clave => $valor) {
                            $$clave = $valor;
                     }

                     $conector = mysql_connect(HOST, USUARIO, PASSWORD);
                     mysql_select_db(BD, $conector);
                     $sql = "SELECT * FROM chofer WHERE cedula = '$cedula' AND activo = 1";
                     $resultado = mysql_query($sql, $conector);
                     mysql_close($conector);

                     if (mysql_num_rows($resultado) == '1') {
                            $linea = mysql_fetch_row($resultado);


                            echo "<div align=\"center\"><div style=\"padding-left: 100px; padding-right: 100px; padding-top: 25px;\">";
                            cadenaFondoAzul("Datos del Chofer");
                            echo "</div></div>";
?>

       <div style="padding-left: 100px; padding-right: 100px; padding-top: 5px;">
              <div style="width: 300px; background-color: aquamarine;" align="center">
              <table>
                     <tr>
                            <td align="left" style="width: 100px;">Nombre</td>
                            <td>
                                   <input type="text" value="<?php echo $linea["2"]; ?>" style="width: 150px;" disabled="true">
                            </td>
                     </tr>
                     <tr>
                            <td align="left" style="width: 100px;">C&eacute;dula</td>
                            <td>
                                   <input type="text" value="<?php echo $linea["1"]; ?>" style="width: 150px;" disabled="true">
                            </td>
                     </tr>
                     <tr>
                            <td align="left" style="width: 100px;">Tel&eacute;fono</td>
                            <td>
                                   <input type="text" value="<?php echo $linea["3"]; ?>" style="width: 150px;" disabled="true">
                            </td>
                     </tr>
                     
              </table>
       </div>
</div>


<?php

} else {
       echo "<div style=\"padding-left: 100px; padding-right: 100px; padding-top: 150px;\">";
       cadenaFondoAzul("No se encontro algun Chofer con esa C&eacute;dula");
       echo "</div>";
}
}
?>
    